version: '3.1'

services:

  db:
    image: mysql
    restart: always
    container_name: db_mysql
    build: mysql/
    environment:
      MYSQL_ROOT_PASSWORD: $MYSQL_ROOT_PASSWORD
      MYSQL_ALLOW_EMPTY_PASSWORD: false
      MYSQL_USER: $MYSQL_USER
      MYSQL_PASSWORD: $MYSQL_PASSWORD
      MYSQL_DATABASE: $MYSQL_DATABASE
    ports:
      - $MYSQL_LOCAL_PORT:3306
    volumes:
      - $MYSQL_LOCAL_DIR:/var/lib/mysql
 
  adminer:
    image: adminer
    restart: always
    container_name: adminer
    depends_on:
      - db
    ports:
      - $ADMINER_LOCAL_PORT:8080

  barin:
    build:
      context: barin/
      args:
        HTTP_PROXY: $HTTP_PROXY
    container_name: barin
    command: bash
    depends_on:
      - db
    environment:
      MYSQL_LOCAL_HOST: $MYSQL_LOCAL_HOST
      MYSQL_LOCAL_PORT: $MYSQL_LOCAL_PORT
      MYSQL_USER: $MYSQL_USER
      MYSQL_PASSWORD: $MYSQL_PASSWORD
      MYSQL_DATABASE: $MYSQL_DATABASE
      OUTLINE_API_URL: $OUTLINE_API_URL
      HTTP_PROXY: $HTTP_PROXY
      TOKEN: $TOKEN
    volumes:
      - $PWD:/develop
    stdin_open: true # docker run -i
    tty: true        # docker run -t

networks:
  host:
    name: host
    external: true
